<template>
  <el-config-provider :locale="locale" :size="size">
    <!-- 开启水印 -->
    <el-watermark
      :font="{ color: fontColor }"
      :content="watermarkEnabled ? defaultSettings.watermarkContent : ''"
      :z-index="9999"
      class="wh-full"
    >
      <router-view />
    </el-watermark>
  </el-config-provider>
</template>
<script setup lang="ts">
import { useAppStore, useSettingsStore } from "@/store";
import defaultSettings from "@/settings";
import { ThemeEnum } from "@/enums/ThemeEnum";
import { SizeEnum } from "@/enums/SizeEnum";
import { onMounted } from "vue";

const appStore = useAppStore();
const settingsStore = useSettingsStore();

const locale = computed(() => appStore.locale);
const size = computed(() => appStore.size as SizeEnum);
const watermarkEnabled = computed(() => settingsStore.watermarkEnabled);

// 明亮/暗黑主题水印字体颜色适配
const fontColor = computed(() => {
  return settingsStore.theme === ThemeEnum.DARK ? "rgba(255, 255, 255, .15)" : "rgba(0, 0, 0, .15)";
});
onMounted(() => {
  // setTimeout(() => {
  //   window.L2Dwidget.init({
  //     pluginRootPath: "live2dw/",
  //     pluginJsPath: "lib/",
  //     pluginModelPath: "live2d-widget-model-z16/assets/",
  //     tagMode: false,
  //     debug: false,
  //     model: { jsonPath: "../live2dw/live2d-widget-model-z16/assets/z16.model.json" },
  //     display: { position: "right", width: 200, height: 300 },
  //     mobile: { show: true },
  //     log: false,
  //   });
  // }, 1000);
});
</script>
